package com.yuexun.beilunpatient.ui.doctorwarn.presenter;

import com.yuexun.beilunpatient.base.BaseEntity;
import com.yuexun.beilunpatient.ui.doctorwarn.bean.DocWarnBean;
import com.yuexun.beilunpatient.ui.doctorwarn.model.IDocWarnModel;
import com.yuexun.beilunpatient.ui.doctorwarn.ui.view.IDocWarnView;

import org.kymjs.kjframe.ui.ViewInject;

import java.util.Map;

import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by chenss on 2018/9/3.
 */
public class DocWarnPresenter implements IDocWarnPresenter {

    private IDocWarnView view;
    private IDocWarnModel model;

    //记录Log
//    private final Logger log = ProUtil.getLogger(LoginPresneter.class);

    public DocWarnPresenter(IDocWarnModel model, IDocWarnView view) {
        this.model = model;
        this.view = view;
    }

    @Override
    public void inquirePatientRemindListByPatient(Map<String, String> praise) {
        model.inquirePatientRemindListByPatient(praise)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Subscriber<BaseEntity<DocWarnBean>>() {
                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {
                        ViewInject.toast("查询医生提醒失败");
                    }

                    @Override
                    public void onNext(BaseEntity<DocWarnBean> entity) {
                        view.getDocWarn(entity);
                    }
                });
    }
}
